<?php
namespace  plugin\banmitongcheng\admin; 
use  plugin\banmitongcheng\model\PluginBanmiTongchengHomeNav; 
use  plugin\banmitongcheng\validate\HomenavValidate;
use app\admin\common\Baseadmin;


class Homenav extends Baseadmin
{
       
      /**
      * @notes  adopt 
      * @variable  id=id;status=; 
      * @date 2023-03-23 14:29:29
      * @author 半米科技低代码一键生成
      */
      public function   updates_adopt(){  
             $request= (new HomenavValidate())->IsCheck('adopt');
             $field=["status"];
             $request['status']= 2;
             $map=[
                  ['id',	'='   ,    input('request.id')  ],
                  ];
             $model =(new PluginBanmiTongchengHomeNav())->updates($map,$request,$field);
              if($model){
               ajaxmsg('更新成功', 200);
              }
               ajaxmsg('更新失败', 0);  
      }
       
      /**
      * @notes  del 
      * @variable  id=id;status=; 
      * @date 2023-03-23 14:29:32
      * @author 半米科技低代码一键生成
      */
      public function   updates_del(){  
             $request= (new HomenavValidate())->IsCheck('del');
             $field=["status"];
             $request['status']= -1;
             $map=[
                  ['id',	'='   ,    input('request.id')  ],
                  ];
             $model =(new PluginBanmiTongchengHomeNav())->updates($map,$request,$field);
              if($model){
               ajaxmsg('更新成功', 200);
              }
               ajaxmsg('更新失败', 0);  
      }
       
      /**
      * @notes  refuse 
      * @variable  id=id;status=;refuse_text=拒绝原因; 
      * @date 2023-03-23 14:29:35
      * @author 半米科技低代码一键生成
      */
      public function   updates_refuse(){  
             $request= (new HomenavValidate())->IsCheck('refuse');
             $field=["status","refuse_text"];
             $request['status']= 0;
             $map=[
                  ['id',	'='   ,    input('request.id')  ],
                  ];
             $model =(new PluginBanmiTongchengHomeNav())->updates($map,$request,$field);
              if($model){
               ajaxmsg('更新成功', 200);
              }
               ajaxmsg('更新失败', 0);  
      }
       
      /**
      * @notes  查询首页轮播 
      * @variable   
      * @date 2023-03-23 14:29:38
      * @author 半米科技低代码一键生成
      */
      public function   paginate_cxsylb(){  
             $request= (new HomenavValidate())->IsCheck();
             $field="id,img,name,type,status,start,json_text";
             $map=[
                   ['status',	'>='   ,    0  ],
                  ];
             $model =(new PluginBanmiTongchengHomeNav())->paginate($map,$field);
             $data['list']=$model;
             ajaxmsg('ok', 200,$data);  
      }
       
      /**
      * @notes  添加公告和轮播 
      * @variable  img=图片;name=内容;status=;type=类型; 
      * @date 2023-03-23 14:52:17
      * @author 半米科技低代码一键生成
      */
      public function   adds_tjgghlb(){  
             $request= (new HomenavValidate())->IsCheck('tjgghlb');
             $field=["img","name","status","type"];
             $request['status']='2';
              $model =(new PluginBanmiTongchengHomeNav())->adds($request,$field);
              if($model){
               ajaxmsg('新增成功', 200);
              }
               ajaxmsg('新增失败', 0);  
      }
      //控制器方法
    
    
    
}